velaif820 2.2.0
Loading...
Searching...
No Matches
main.c File Reference

Vela IF820 Click Example. More...

#include "board.h"
#include "log.h"
#include "velaif820.h"

Macros

#define MESSAGE_CONTENT   "Vela IF820 Click board - demo example."
#define APP_BUFFER_SIZE   500
#define PROCESS_BUFFER_SIZE   200
#define SET_BT_CLASSIC_FLAG   "T=92"
#define GET_BT_CLASSIC_NAME   "T=1"
#define BT_TERMINAL_TIMEOUT_MS   60000
#define BT_TERMINAL_MESSAGE_FREQ_MS   5000
#define TERMINATION_CMD   "END"
#define TERMINATION_RESPONSE   "END command received, the connection will be terminated in a few seconds."
#define TERMINATION_TIMEOUT   "Timeout, closing the connection in a few seconds."

Enumerations

enum  velaif820_app_state_t { VELAIF820_POWER_UP = 1 , VELAIF820_CONFIG_EXAMPLE , VELAIF820_EXAMPLE }
 Example states. More...

Functions

void application_init (void)
void application_task (void)
int main (void)

Detailed Description

Vela IF820 Click Example.

Description

This example demonstrates the use of Vela IF820 Click board by processing data from a connected BT Classic device.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger.

Application Task

Application task is split in few stages:

  • VELAIF820_POWER_UP: Powers up the device and checks the communication.
  • VELAIF820_CONFIG_EXAMPLE: Restores factory settings, sets BT Classic flags and reads the BT address and name.
  • VELAIF820_EXAMPLE: Performs a BT terminal example by processing all data from a connected BT Classic device and sending back an adequate response messages.

Additional Function

  • static void velaif820_clear_app_buf ( void )
  • static void velaif820_log_app_buf ( void )
  • static err_t velaif820_process ( velaif820_t *ctx )
  • static err_t velaif820_wait_packet ( velaif820_t *ctx, uint8_t timeout_s, uint8_t rsp_flag, uint8_t *cmd_code )
  • static err_t velaif820_power_up ( velaif820_t *ctx )
  • static err_t velaif820_config_example ( velaif820_t *ctx )
  • static err_t velaif820_example ( velaif820_t *ctx )
Note
We have used the Serial Bluetooth Terminal smartphone application for the test. A smartphone and the Click board must be paired in order to exchange messages with each other.
Author
Stefan Filipovic

Macro Definition Documentation

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   500

◆ BT_TERMINAL_MESSAGE_FREQ_MS

#define BT_TERMINAL_MESSAGE_FREQ_MS   5000

◆ BT_TERMINAL_TIMEOUT_MS

#define BT_TERMINAL_TIMEOUT_MS   60000

◆ GET_BT_CLASSIC_NAME

#define GET_BT_CLASSIC_NAME   "T=1"

◆ MESSAGE_CONTENT

#define MESSAGE_CONTENT   "Vela IF820 Click board - demo example."

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ SET_BT_CLASSIC_FLAG

#define SET_BT_CLASSIC_FLAG   "T=92"

◆ TERMINATION_CMD

#define TERMINATION_CMD   "END"

◆ TERMINATION_RESPONSE

#define TERMINATION_RESPONSE   "END command received, the connection will be terminated in a few seconds."

◆ TERMINATION_TIMEOUT

#define TERMINATION_TIMEOUT   "Timeout, closing the connection in a few seconds."

Enumeration Type Documentation

◆ velaif820_app_state_t

Example states.

Predefined enum values for application example state.

Enumerator
VELAIF820_POWER_UP 
VELAIF820_CONFIG_EXAMPLE 
VELAIF820_EXAMPLE 

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )